raw_input
and %debug
in the Notebook¶The Notebook has added support for raw_input
and %debug
, as of 1.0.
# Python 3 compat
import sys
if sys.version_info[0] >= 3:
raw_input = input
name = raw_input("What is your name? ")
name
What is your name? Sir Robin
'Sir Robin'
def div(x, y):
return x/y
div(1,0)
--------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) <ipython-input-4-a5097cc0c0c5> in <module>() 2 return x/y 3 ----> 4 div(1,0) <ipython-input-4-a5097cc0c0c5> in div(x, y) 1 def div(x, y): ----> 2 return x/y 3 4 div(1,0) ZeroDivisionError: division by zero
%debug
> <ipython-input-4-a5097cc0c0c5>(2)div() 1 def div(x, y): ----> 2 return x/y 3 ipdb> x 1 ipdb> y 0 ipdb> bt <ipython-input-4-a5097cc0c0c5>(4)<module>() 1 def div(x, y): 2 return x/y 3 ----> 4 div(1,0) > <ipython-input-4-a5097cc0c0c5>(2)div() 1 def div(x, y): ----> 2 return x/y 3 4 div(1,0) ipdb> exit